package org.soaring.btn;

import java.awt.Color;
import java.awt.event.MouseEvent;

import javax.swing.SwingConstants;

import org.come.Frame.RoleToggleJframe;
import org.come.bean.LoginResult;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.FormsManagement;
import org.come.until.MessagrFlagUntil;
import org.soaring.panel.SoaringMainFrame;

import com.tool.btn.MoBanBtn;
import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;

public class CharacterBtn extends MoBanBtn {

	/**
	 * 字段名:pang <br>
	 * 1是名字按钮 2是id按钮 3称谓按钮 4切属性按钮 5转换按钮
	 */
	private int pang;

	public CharacterBtn(String iconpath, int type, int pang) {
		super(iconpath, type);
		this.pang = pang;
	}

	public CharacterBtn(String iconpath, int type, Color[] colors, String text, int pang) {
		super(iconpath, type, colors);
		this.pang = pang;
		setText(text);
		setFont(UIUtils.TEXT_FONT2);
		setHorizontalTextPosition(SwingConstants.CENTER);
		setVerticalTextPosition(SwingConstants.CENTER);
	}

	@Override
	public void chooseyes() {
		// TODO Auto-generated method stub

	}

	@Override
	public void chooseno() {
		// TODO Auto-generated method stub

	}

	@Override
	public void nochoose(MouseEvent e) {
		// TODO Auto-generated method stub
		//
		switch (pang) {
			case 1:

				break;
			case 2:
//				List<Integer> types = new ArrayList<>();
//				types.add(0);
//				types.add(1);
//				types.add(2);
//				types.add(3);
//				types.add(4);
//				types.add(5);
//				types.add(6);
//				ChooseLiangHaoTypeJframe.getChooseLiangHaoTypeJframe().getChooseLiangHaoTypeJpanel().init(types);
				FormsManagement.showForm(640);
				break;
			case 3:// 向服务器发送消息请求称谓列表
				String sendmes = Agreement.getAgreement().TitleListAgreement();
				SendMessageUntil.toServer(sendmes);
				break;
			case 4:
				RoleToggleJframe.getRoleToggleJframe().getRoleToggleJpanel().getplayerValue();
				FormsManagement.showForm(123);
				break;
			case 5:
				LoginResult loginResult = RoleData.getRoleData().getLoginResult();
				SoaringMainFrame
						.getSoaringMainFrame()
						.getSoaringPanel()
						.SoaringExprience(loginResult.getGrade(), loginResult.getExperience(),
								loginResult.getExtraPointInt("F"), loginResult.getXiuwei());
				FormsManagement.showForm(81);
				break;

			default:
				break;
		}

	}
	@Override
	public void mouseEntered(final MouseEvent e) {
		if (MessagrFlagUntil.ImgFlagImg.equals(MessagrFlagUntil.MOUSE1)) {
			MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE12);
		}
	}

	@Override
	public void mouseExited(final MouseEvent e) {
		if (MessagrFlagUntil.ImgFlagImg.equals(MessagrFlagUntil.MOUSE12)) {
			MessagrFlagUntil.setMouse(MessagrFlagUntil.MOUSE1);
		}
	}

}
